package com.vladimirjosu.fhc;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 */

/**
 * @author vjosu
 * 
 */
public class FindMin {

	private List<Integer> m;
	private int n;
	private int k;

	public FindMin(int n, int k, int a, int b, int c, int r) {
		this.n = n;
		this.k = k;
		init(n, k, a, b, c, r);
	}

	private void init(int n, int k, int a, int b, int c, int r) {
		m = new ArrayList<Integer>(n);
		m.add(0, a);
		for (int i = 1; i < k; i++) {
			int tmp = (b * m.get(i - 1) + c) % r;
			m.add(i, tmp);
		}
	}

	public String solve() {
		int mm[] = new int[n];
		for (int i = 0; i < n; i++) {
			mm[i] = 0;
		}
		for (int i = 0; i < k; i++) {
			mm[m.get(i)] = 1;
		}
		return m.toString();
	}

}
